<extend name="Public/base" />
<block name="content">
   <center>
       <select  id="stuName" style="margin-top: 5%;width: 20%;height: 33px">
           <option value="0" selected>请选择</option>
           <volist name="sn" id="sn">
               <option value="<{$sn.student_id}>"><{$sn.sname}></option>
           </volist>
       </select>
       <div class="row" style="margin-top: 5%" id="row"></div>
   </center>
    <script>
        $('#stuName').change(function () {
            if($('#stuName option:selected').val()=='0'){
                $('#row').html('');
            }else {
                $.post("<{:U('Director/getScore')}>",{id:$('#stuName option:selected').val()},function (data) {
                    var html='<table>';
                    var scoreEnd=parseFloat(data['num']['exaNum'])-parseFloat(data['num']['poiNum']);
                    if(data['exa']=='暂无考试成绩记录'){
                        html+='<tr><td colspan="3" style="text-align: center">'+data['exa']+'</td></tr>';
                    }else{
                        for(i in data['exa']){
                            html+='<tr><td>'+data['exa'][i]['examtime']+'</td><td style="text-align: center">'+data['exa'][i]['term']+data['exa'][i]['val']+'</td><td>'+data['exa'][i]['score']+'</td></tr>'
                        }
                    }
                    if(data['poi']=='暂无扣分记录'){
                        html+='<tr><td colspan="3" style="text-align: center">'+data['poi']+'</td></tr>';
                    }else{
                        for(i in data['poi']){
                            html+='<tr><td>'+data['poi'][i]['points_time']+'</td><td>'+data['poi'][i]['role_name']+'</td><td>'+data['poi'][i]['score']+'</td></tr>'
                        }
                    }
                    html+='<tr><td>总分:</td><td colspan="2" style="text-align: center">'
                            +data['num']['exaNum']+'-'+data['num']['poiNum']+'='+scoreEnd
                            +'</td></tr></table>'
                    html+='<buttom class="button tiny  radius danger" onclick="gd()">归档</buttom>'
                    $('#row').html(html);
                })
            }
        })
        function gd() {
            $.post("<{:U('Director/filed')}>",{id:$('#stuName option:selected').val()},function (data) {
                alert(data);
            })
        }
    </script>
</block>